package personal.model.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import personal.model.vo.AdminVO;
import personal.model.vo.DeptVO;
import personal.model.vo.EmpVO;
import personal.model.vo.GradeVO;

public class PersonalManagementDaoImpl extends SqlMapClientDaoSupport
		implements PersonalManagementDao{
	@Override
	public List<DeptVO> selectDeptCode() throws SQLException {
		return this.getSqlMapClient().queryForList("personal.selectDeptCode");
	}
	@Override
	public List<AdminVO> selectAdminCode() throws SQLException {
		return this.getSqlMapClient().queryForList("personal.selectAdminCode");
	}
	@Override
	public List<GradeVO> selectGradeCode() throws SQLException {
		return this.getSqlMapClient().queryForList("personal.selectGradeCode");
	}
	@Override
	public void insertPersonalCard(EmpVO empVO) throws SQLException {
		this.getSqlMapClient().insert("personal.insertPersonalCard", empVO);
	}
	@Override
	public List<EmpVO> selectPersonalCardResult(String selectMethod, String selectValue) throws SQLException {
		HashMap map=new HashMap();
		map.put("selectMethod", selectMethod);
		map.put("selectValue", selectValue);
		return (List<EmpVO>)this.getSqlMapClient().queryForList("personal.selectPersonalCard_result", map);
	}
	@Override
	public void deletePersonalCard(int empNo) throws SQLException {
		this.getSqlMapClient().delete("personal.deletePersonalCard", empNo);
	}
	@Override
	public EmpVO selectPersonalCardByEmpNo(int empNo) throws SQLException {
		return (EmpVO)this.getSqlMapClient().queryForObject("personal.selectPersonalCardByEmpNo", empNo);
	}
	@Override
	public void updatePersonalCard(EmpVO empVO) throws SQLException {
		this.getSqlMapClient().update("personal.updatePersonalCard", empVO);
	}
}